package com.jack006.exception;

import com.jack006.grace.result.ResponseStatusEnum;

/**
 * @Classname MyCustomerException
 * @Description 自定义异常
 * 目的：
 *   统一处理异常信息
 *   便于解耦，service 与 controller 错误的解耦，不会被 service 返回的类型被限制
 * @Date 2021-06-13 15:40
 * @Created by jack
 */
public class MyCustomerException extends RuntimeException {

    private ResponseStatusEnum responseStatusEnum;

    public MyCustomerException(ResponseStatusEnum responseStatusEnum){
        super("出现状态码为："+responseStatusEnum.status()
                +";具体异常信息为："+responseStatusEnum.msg());
        this.responseStatusEnum = responseStatusEnum;
    }

    public ResponseStatusEnum getResponseStatusEnum() {
        return responseStatusEnum;
    }

    public void setResponseStatusEnum(ResponseStatusEnum responseStatusEnum) {
        this.responseStatusEnum = responseStatusEnum;
    }
}
